package com.xiaoma.thread.locksupport;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.LockSupport;

public class LockTest {

  public static void main(String[] args) {
    AtomicBoolean status = new AtomicBoolean(false);
    Thread waiter = new Thread(()->{
      while (!status.get()) {
        LockSupport.park();
      }
    });

    status.compareAndSet(false, true);
    LockSupport.unpark(waiter);

  }
}
